package com.ict.txmsv2.services;

import com.ict.txmsv2.mapper.TodoListMapper;
import com.ict.txmsv2.model.TodoList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author yoleen
 * @date 2020/12/16 14:56
 */

@Service
public class ToDoListService {
    @Autowired
    TodoListMapper todoListMapper;

    public List<TodoList> getTodoLists(int userid) {
        return todoListMapper.getTodoLists(userid);
    }

    public int addTodo(TodoList todoList) {
        return todoListMapper.insertSelective(todoList);
    }

    public int updateTodo(TodoList todoList) {
        return todoListMapper.updateByPrimaryKeySelective(todoList);
    }

    public int deleteTodo(int id) {
        return todoListMapper.deleteByPrimaryKey(id);
    }
}
